#include <iostream>
using namespace std;

char * substring(const char * const s, int start, int end)
{
  char * pNewString = new char[end - start + 1 + 1];

  int j = 0;
  for (int i = start; i <= end; i++, j++)
  {
    pNewString[j] = s[i];
  }

  pNewString[j] = '\0'; // Set a null terminator

  return pNewString;
}

int count(const char * const s, char a)
{
  int result = 0;
  if (strlen(s) > 0)
    result = count(substring(s, 1, strlen(s) - 1), a) +
      ((s[0] == a) ? 1 : 0);

  return result;
}

int main()
{
  cout << count("Welcome", 'e') << endl;

  return 0;
}
